home *** CD-ROM | disk | FTP | other *** search
- Q34409 Incorrect C2129 Error Generated for Static Function
- C Compiler
- 5.10 | 5.10
- MS-DOS | OS/2
-
- Summary:
-
- The compiler incorrectly generates the error "C2129: static function
- `identifier' not found" under the following circumstances:
-
- 1. The function has "static" visibility.
- 2. The function is defined after the functions that call it.
- 3. There are two functions calling it, or there only is one
- function calling it, but the /Za option is being used.
- 4. The functions calling it declare it with function prototypes
- locally (i.e., inside the function rather than outside of it).
-
- Microsoft has confirmed this to be a problem in Version 5.10. We
- are researching this problem and will post new information as
- it becomes available.
-
- To work around the problem, change one of the requirements listed above
- (i.e., remove the "static" keyword, or define the function before it
- is used, or move the function prototypes outside of any function).
-
- More Information:
-
-
- The sample program below demonstrates a problem in C Version 5.10. The
- compiler generates a C2129 error on the second call to y(); it seems
- to "forget" that y is defined later in the file.
-
- This problem will not occur if any of the following are true:
-
- 1. The y() function is not given the "static" attribute.
- 2. The test() function does not call y() and /Ze is used.
- 3. The function prototypes for y() are moved out from inside the
- functions test() and x().
-
- To work around the problem, compile with /W3 to see C4074 warnings.
- Compile with /Ze; then with /Za to see the difference in C2129 errors.
-
- The following program demonstrates the problem:
-
- #include <stdio.h>
-
- void test(void);
- void test (void)
- {
- static void y (char c); /* C4074 warning if /W3 /Ze used */
- char c = 't';
- y (c) ; /* C2129 error on this line */
- }
-
- void x (void);
- void x (void)
- {
- static void y (char c); /* C4074 warning if /W3 /Ze used */
- char c = 'x';
- y (c); /* C2129 error on this line if /Za used */
- }
-
- static void y (char c)
- {
- printf ("%c\n", c);
- }
-
- Keywords: buglist5.10
- Updated 88/08/19 07:41
-